﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WP8_Client.Model
{
    public class CurrentUser : INotifyPropertyChanged
    {        
        public Int32 ID { get; set; }

        String cUserName = "";
        public String UserName 
        { 
            get 
            {
                return this.cUserName; 
            } 
            set
            {
                this.cUserName = value;
                this.RaisePropertyChanged("UserName");
            } 
        }
        String cPassword = "";
        public String Password
        {
            get
            {
                return this.cPassword;
            }
            set
            {
                this.cPassword = value;
                this.RaisePropertyChanged("Password");
            }
        }
        String cLocation = "";
        public String Location
        {
            get
            {
                return this.cLocation;
            }
            set
            {
                this.cLocation = value;
                this.RaisePropertyChanged("Location");
            }
        }
        public ObservableCollection<User> Contacts { get; private set; }
        

        public event PropertyChangedEventHandler PropertyChanged;
                
        public CurrentUser()
        {
            this.Contacts = new ObservableCollection<User>();
            this.Contacts.CollectionChanged += (o, e) => { this.RaisePropertyChanged("Contacts"); };
        }

        void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
